package 补充.输入输出操作.文件操作;

import java.io.*;
import java.util.Enumeration;
import java.util.Vector;

public class 合并流2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis1 = new FileInputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\read.txt");
        FileInputStream fis2 = new FileInputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\read2.txt");
        FileInputStream fis3 = new FileInputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\read3.txt");
        Vector v = new Vector();
        v.addElement(fis1);
        v.addElement(fis2);
        v.addElement(fis3);
        Enumeration e = v.elements();
        SequenceInputStream sis = new SequenceInputStream(e);
        FileOutputStream fos=new FileOutputStream("D:\\Learn\\javademo\\untitled\\src\\补充_偏\\输入输出操作\\文件\\read.txt");
        int len;
        byte[] b = new byte[1024];
        while ((len=sis.read(b))!=-1){
            fos.write(b,0,len);
            fos.write("\r\n".getBytes());
        }
        fos.close();
        sis.close();

    }
}
